{subtemplate template/common/com_header.html}
<script type='text/javascript' src='./template/js/jquery1.8.js'></script>
<script type='text/javascript' src='./template/js/ajaxfileupload.js'></script>

<script type='text/javascript'>
function upload(){
    $.ajaxFileUpload({
          url:'?m=photos&a=cate_upload',
          dataType:'json',
          fileElementId:'catefile',
          success:function(feed){
              $('table tr:nth-child(2)').children().html('<img src="'+feed.img+'" width="100" height"100" />');
              $(':input[name="img"]').attr('value',feed.img);
          }
        });
    return false;
}

$(function(){
    $(':input[name="cate_name"]').change(function(e){
        var obj=$(':input[name="catefile"]');
        if($(this).children('option:selected').val()!='{$id}'){
          obj.parent().parent().css('display','none');
          $('table tr:nth-child(2)').css('display','none');
        }else{
          obj.parent().parent().css('display','block');
          $('table tr:nth-child(2)').css('display','block');
        }
    });

$(':submit').click(function(){
	var cateId=$(':input[name="cate_name"]').children('option:selected').val();
	if(cateId!='{$id}')
        $(':input[name="img"]').attr('value','');
});

    
});

</script>

<form action='?m=photos&a=cate_update&special=modify' method='post'>
<table width='100%' border='0' cellspacing='0' cellpadding='0' style='border:1px solid #ccc;'>
<tr>
  <td>
         分类名称：<select name="cate_name">
               {loop $cates $cid $cval}
               <option value="{$cval['id']}">{$cval['cate_name']}</option>
               {/loop}
             </select>
             <input type='text' size='20' name='cate_sub' style='display:inline-block;' />
 </td>
</tr>
<tr><td colspan='2'>&nbsp;{if $img}<img src="{$img}" width="100" height="100" />{/if}</td></tr>
<tr><td ><input type="file" name='catefile' id='catefile' />&nbsp;<input type='button' value='上传' onclick='upload();' /></td></tr>
<tr><td ><input type="submit" name='' value="修改" />&nbsp;<input type='reset' value='取消' />&nbsp;&nbsp;<input type='button' value="返回" onclick="location.href='{$backUrl}';" /></td></tr>
</table>
<input type='hidden' name='img' value="{$img}" />
</form>




{subtemplate template/common/com_footer.html}